Subsequent VM Creation is failing for ISCSI Storage Pool on Oracle Linux - #88
Subsequent VM Creation is failing for ISCSI Storage Pool on Oracle Linux#88suryag1201 wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses failures when creating subsequent VMs on iSCSI primary storage with KVM (notably on Oracle Linux) by making iSCSI login/rescan behavior more robust and adding additional readiness checks before proceeding.
Changes:
- Adds explicit handling for iscsiadm exit codes and a pre-login session existence check to decide when a rescan is needed.
- Updates iSCSI login result handling to be idempotent across distros (Ubuntu vs Oracle Linux behavior) and triggers rescans when a session pre-exists.
- Adds extra validation for device readiness and improves by-path filesystem checks before calling
blockdev.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/IscsiAdmStorageAdaptor.java:177
- The warning uses
volumeUuidas the “target” identifier, but the log message is about the iSCSI target/portal; this can be misleading when troubleshooting. Use the computed IQN (iqn) in the message (and optionally include the volume path separately).
if (getPhysicalDisk(volumeUuid, pool).getSize() <= 0) {
logger.warn("iSCSI device not ready for target {} at {}:{} after wait", volumeUuid, host, port);
return false;
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/IscsiAdmStorageAdaptor.java:366
Files.isRegularFile(devicePath)follows symlinks by default, so a by-path symlink that (incorrectly) points to a regular file will be reported as a “regular file at by-path”, and the subsequentisSymbolicLinkcheck becomes unreachable in that case. CheckisSymbolicLinkfirst, or useNOFOLLOW_LINKSto test the path itself.
if (Files.isRegularFile(devicePath)) {
logger.warn("Found a corrupt regular file at iSCSI by-path {} (expected block device symlink); it must be removed manually", deviceByPath);
return 0L;
}
if (!Files.isSymbolicLink(devicePath)) {
🔴 Test Coverage Grade:
|
| Metric | Value |
|---|---|
| Line coverage | 24.58% |
| Branch coverage | 18.75% |
Grade Scale
| Grade | Line Coverage | Meaning |
|---|---|---|
| 🟢 A | ≥ 80% | Excellent - this code sleeps well at night 😴 |
| 🟡 B | 60-79% | Good - almost there, don't stop now 😉 |
| 🟠 C | 40-59% | Acceptable - your code is wearing a seatbelt, but no airbags 😬 |
| 🔴 D | 20-39% | Marginal - boldly shipping where no test has gone before 🖖 |
| ⛔ F | < 20% | Failing - tests? what tests? 🔥 |
Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run
Description
Subsequent VM Creation is failing for ISCSI Storage Pool on Oracle Linux
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Tested on both Oracle and Unbuntu and tried creating multiple VMs
How did you try to break this feature and the system with this change?